// 首页模块接口
import request from "@/utils/request"

// ts 数据类型
import type { HospitalResponseData, HospitalLARResponseData, HospiByKeys } from "./type"

// 通过枚举管理首页模块的接口地址
enum API {
    // 获取已有的医院数据接口地址
    HOSPITAL_URL = '/hosp/hospital/',
    // 获取医院等级与地区接口地址
    HOSPITALLEVELANDREGION_URL = '/cmn/dict/findByDictCode/',
    // 根据关键字获取医院数据
    HOSPIBYKEYS_URL = '/hosp/hospital/findByHosname/'
}

// 获取医院的数据
export const reqHospital = (page: number, limit: number, hostype = '', districtCode = '') => request.get<any, HospitalResponseData>(API.HOSPITAL_URL + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`);
// 获取医院等级/地区
export const reqHospiLAR = (dictCode: string) => request.get<any, HospitalLARResponseData>(API.HOSPITALLEVELANDREGION_URL + dictCode);
// 根据关键字获取医院数据
export const reqHospiByKeys = (hostname: string) => request.get<any, HospiByKeys>(API.HOSPIBYKEYS_URL + hostname);
